import sys
from .utils import Utils
from .model import Model
from .robot import Robot

class Init:

    def __init__(self):
        self.utils = Utils(self)
        self.model = Model(self)
        self.robot = Robot(self)

    # 通过串口方式连接设备
    def connect_device(self, connect_type, address, port):
        self.utils.device.connect_device(connect_type, address, port)

    # 仿真数据同步状态
    def open_world(self, status):
        self.utils.device.open_world_status = status

    # 输出调试日志
    def log(self, data):
        log = {"command": "run:debug", "body": data}
        self.utils.service.write(log)
        print(data)
